﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using eschoolBO;

namespace ESCHOOL.parents
{
    public partial class WebForm5 : System.Web.UI.Page
    {
        report re = new report();
        parent par = new parent();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt1 = par.GetRecords(Convert.ToInt64(Session["userid"]), "", "", "", "", "", "", "", -99, "", -99, "", "", -99,"","", false, " and ");
                DataTable dt = re.GetRecords(-99, "", -99,Convert.ToInt64(dt1.Rows[0]["student_id"].ToString()), -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, "", -99, false, " and ");
                DetailsView1.DataSource = dt;
                DetailsView1.DataBind();
                //GridView1.DataSource = dt;
                //GridView1.DataBind();
            }
        }

        protected void ddexams_TextChanged(object sender, EventArgs e)
        {
            DataTable dt1 = par.GetRecords(Convert.ToInt64(Session["userid"]), "", "", "", "", "", "", "", -99, "", -99, "", "", -99,"","", false, " and ");
            DataTable dt = re.GetRecords(-99,ddexams.SelectedValue.ToString(), -99, Convert.ToInt64(dt1.Rows[0]["student_id"].ToString()), -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, "", -99, false, " and ");
            //DetailsView1.DataSource = dt;
            //DetailsView1.DataBind();
            GridView2.DataSource = dt;
            GridView2.DataBind();
        }

        protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView2.PageIndex = e.NewPageIndex;
            DataTable dt1 = par.GetRecords(Convert.ToInt64(Session["userid"]), "", "", "", "", "", "", "", -99, "", -99, "", "", -99, "", "", false, " and ");
            DataTable dt = re.GetRecords(-99, "", -99, Convert.ToInt64(dt1.Rows[0]["student_id"].ToString()), -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, "", -99, false, " and ");
            GridView2.DataSource = dt;
            GridView2.DataBind();    
        }
    }
}
